import { IPSAppCounterRef } from '../app/control/ipsapp-counter-ref';
import { IPSAppViewEngine } from '../app/view/ipsapp-view-engine';
import { IPSAppViewLogic } from '../app/view/ipsapp-view-logic';
import { IPSAppViewRef } from '../app/view/ipsapp-view-ref';
import { IPSAppViewUIAction } from '../app/view/ipsapp-view-uiaction';
import { IPSControl } from './ipscontrol';
import { IPSControlContainer } from './ipscontrol-container';
import { PSControlImpl } from './pscontrol-impl';

export class PSControlContainerImpl extends PSControlImpl implements IPSControlContainer {
  protected psappcounterrefs: IPSAppCounterRef[] | null = null;

  getPSAppCounterRefs(): IPSAppCounterRef[] | null {
    if (this.psappcounterrefs == null) {
      this.psappcounterrefs = this.fillChildListModel(this.M.getPSAppCounterRefs, 'app.control.IPSAppCounterRef') as IPSAppCounterRef[];
    }
    return this.psappcounterrefs;
  }

  get psAppCounterRefs(): IPSAppCounterRef[] | null {
    return this.getPSAppCounterRefs();
  }

  findPSAppCounterRef(objKey: any): IPSAppCounterRef | null {
    return this.getPSModel5('app.control.IPSAppCounterRef', this.getPSAppCounterRefs(), objKey) as IPSAppCounterRef;
  }

  protected psappviewengines: IPSAppViewEngine[] | null = null;

  getPSAppViewEngines(): IPSAppViewEngine[] | null {
    if (this.psappviewengines == null) {
      this.psappviewengines = this.fillChildListModel(this.M.getPSAppViewEngines, 'app.view.IPSAppViewEngine') as IPSAppViewEngine[];
    }
    return this.psappviewengines;
  }

  get psAppViewEngines(): IPSAppViewEngine[] | null {
    return this.getPSAppViewEngines();
  }

  findPSAppViewEngine(objKey: any): IPSAppViewEngine | null {
    return this.getPSModel5('app.view.IPSAppViewEngine', this.getPSAppViewEngines(), objKey) as IPSAppViewEngine;
  }

  protected psappviewlogics: IPSAppViewLogic[] | null = null;

  getPSAppViewLogics(): IPSAppViewLogic[] | null {
    if (this.psappviewlogics == null) {
      this.psappviewlogics = this.fillChildListModel(this.M.getPSAppViewLogics, 'app.view.IPSAppViewLogic') as IPSAppViewLogic[];
    }
    return this.psappviewlogics;
  }

  get psAppViewLogics(): IPSAppViewLogic[] | null {
    return this.getPSAppViewLogics();
  }

  findPSAppViewLogic(objKey: any): IPSAppViewLogic | null {
    return this.getPSModel5('app.view.IPSAppViewLogic', this.getPSAppViewLogics(), objKey) as IPSAppViewLogic;
  }

  protected psappviewrefs: IPSAppViewRef[] | null = null;

  getPSAppViewRefs(): IPSAppViewRef[] | null {
    if (this.psappviewrefs == null) {
      this.psappviewrefs = this.fillChildListModel(this.M.getPSAppViewRefs, 'app.view.IPSAppViewRef') as IPSAppViewRef[];
    }
    return this.psappviewrefs;
  }

  get psAppViewRefs(): IPSAppViewRef[] | null {
    return this.getPSAppViewRefs();
  }

  findPSAppViewRef(objKey: any): IPSAppViewRef | null {
    return this.getPSModel5('app.view.IPSAppViewRef', this.getPSAppViewRefs(), objKey) as IPSAppViewRef;
  }

  protected psappviewuiactions: IPSAppViewUIAction[] | null = null;

  getPSAppViewUIActions(): IPSAppViewUIAction[] | null {
    if (this.psappviewuiactions == null) {
      this.psappviewuiactions = this.fillChildListModel(this.M.getPSAppViewUIActions, 'app.view.IPSAppViewUIAction') as IPSAppViewUIAction[];
    }
    return this.psappviewuiactions;
  }

  get psAppViewUIActions(): IPSAppViewUIAction[] | null {
    return this.getPSAppViewUIActions();
  }

  findPSAppViewUIAction(objKey: any): IPSAppViewUIAction | null {
    return this.getPSModel5('app.view.IPSAppViewUIAction', this.getPSAppViewUIActions(), objKey) as IPSAppViewUIAction;
  }

  protected pscontrols: IPSControl[] | null = null;

  getPSControls(): IPSControl[] | null {
    if (this.pscontrols == null) {
      this.pscontrols = this.fillChildListModel(this.M.getPSControls, 'control.IPSControl') as IPSControl[];
    }
    return this.pscontrols;
  }

  get psControls(): IPSControl[] | null {
    return this.getPSControls();
  }

  findPSControl(objKey: any): IPSControl | null {
    return this.getPSModel5('control.IPSControl', this.getPSControls(), objKey) as IPSControl;
  }

  get cls(): string {
    return 'PSControlContainerImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'control.IPSControlContainer') return true;
    return super.instanceof(cls);
  }
}
